package com.wbp.cms.client.common.vo;


/**
 * @Description: 
 * @Department:
 * @author andy.lhc
 * @date 2016年4月5日 下午3:24:03 
 */
import java.io.Serializable;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.google.zxing.qrcode.decoder.Version;

/**
 * 
 */
public class ZXingOptionalVO implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = -3174968196246889746L;

    /**
     * 二维码基本属性
     */
    private ErrorCorrectionLevel ecLevel; // 容错率(即恢复能力,默认L);L=~7%,M=~15%,Q=~25%,H=~30%.
    private int margin; // 边缘(指定值为最小边缘，实际值>=margin,默认4pix)
    private Version version; // 指定生成二维码的版本
    
    /**
     * 二维码颜色设置
     */
    private Integer pdpInnerColor = 0xFF000000; // 位置探测图形内点,默认和前景色一样
    private Integer foregroundColor = 0xFF000000; // 前景色，默认 黑色
    private Integer backgroundColor = 0xFFFFFFFF; // 背景色 ， 默认白色
    
    
    /**
     * 二维码扩展属性
     */
    private String logo; // 二维码中间LOGO的TFS文件名,如果是本地调用请直接参考ZXingUtil
    private String brief; // 二维码正下方文字说明
    private Integer briefFontSize; // 二维码brief字号大小

    @Override
    public String toString() {

        String string = null;

        String delimiter = "\t";
        string = new StringBuilder().
                append(ecLevel).append(delimiter).
                append(margin).append(delimiter).
                append(version).append(delimiter).
                append(pdpInnerColor).append(delimiter).
                append(foregroundColor).append(delimiter).
                append(backgroundColor).append(delimiter).
                append(logo).append(delimiter).
                append(brief).append(delimiter)
                .toString();

        return string;
    }

    /**
     * 默认值
     */
    public static final ErrorCorrectionLevel DEFAULT_ERROR_CORRECTION_LEVEL = ErrorCorrectionLevel.L;
    public static final int DEFAULT_MARGIN = 0;
    public static final String DEFAULT_CHARACTER_SET = null;

    /**
     * 
     */
    public ErrorCorrectionLevel getEcLevel() {
        return (null == ecLevel ? DEFAULT_ERROR_CORRECTION_LEVEL : ecLevel);
    }

    public void setEcLevel(ErrorCorrectionLevel ecLevel) {
        this.ecLevel = ecLevel;
    }

    public int getMargin() {
        return (0 > margin ? DEFAULT_MARGIN : margin);
    }

    public void setMargin(int margin) {
        this.margin = margin;
    }

    public String getCharacterSet() {
        return (null == characterSet ? DEFAULT_CHARACTER_SET : characterSet);
    }

    public void setCharacterSet(String characterSet) {
        this.characterSet = characterSet;
    }

    public Version getVersion() {
        return version;
    }

    public void setVersion(Version version) {
        this.version = version;
    }
    
    public Integer getPdpInnerColor() {
        return pdpInnerColor;
    }

    public void setPdpInnerColor(Integer pdpInnerColor) {
        this.pdpInnerColor = pdpInnerColor;
    }

    public Integer getForegroundColor() {
        return foregroundColor;
    }

    public void setForegroundColor(Integer foregroundColor) {
        this.foregroundColor = foregroundColor;
    }

    public Integer getBackgroundColor() {
        return backgroundColor;
    }

    public void setBackgroundColor(Integer backgroundColor) {
        this.backgroundColor = backgroundColor;
    }

    public String getLogo() {
        return logo;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    public String getBrief() {
        return brief;
    }

    public void setBrief(String brief) {
        this.brief = brief;
    }

    @Deprecated // 已废弃，不需要指定字符集
    private String characterSet; // 字符集

    public Integer getBriefFontSize() {
        return briefFontSize;
    }

    public void setBriefFontSize(Integer briefFontSize) {
        this.briefFontSize = briefFontSize;
    }
    
}
